home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 033a / useron21.zip / DOIT.PAS next >
Pascal/Delphi Source File  |  1991-02-23  |  3KB  |  114 lines

  1. {-----------------------------------------------------------------------------|
  2.  
  3.  DoIt 1.0
  4.  Gerhard Hoogterp (2:283/1.2 27:4331/106 HOOGTERPG@HENUT5.BITNET)
  5.  23 Feb 1991
  6.  
  7.  Dumped in the Public domain, do with it whatever you like. Note however
  8.  that the usage of this unit is completely on your own risk!
  9.  
  10.  Oh, don't make the DoString longer than 70 characters. UserOn.Exe will chop
  11.  
  12. |-----------------------------------------------------------------------------}
  13.  
  14.  
  15. Unit DoIt;
  16. Interface
  17. Uses Dos;
  18.  
  19. Type  DoString  = String[70];
  20.  
  21. {------------------------------------------------------------------------|
  22.   Fill DoingWhat with the string you want to appear in the UserOn door
  23. |------------------------------------------------------------------------}
  24.  
  25. Const DoingWhat : DoString = 'Working with a LiveSystems door.';
  26.       DefaultStr: DoString = 'In a door/external utility';
  27.  
  28. {------------------------------------------------------------------------|
  29.   GrabInfo Lookes for the USERDOES.<NodeNr> file and returns it's
  30.   contents when found. If not found the default string is returned.
  31. |------------------------------------------------------------------------}
  32.  
  33. Function GrabInfo(LineNr : Byte):DoString;
  34.  
  35. {------------------------------------------------------------------------|
  36.   SetDoingInfo writes a file USERDOES.<NodeNr> with the DoingWhat string
  37. |------------------------------------------------------------------------}
  38.  
  39. Procedure SetDoingInfo(LineNr : Byte);
  40.  
  41. {------------------------------------------------------------------------|
  42.  ClearDoingInfo erases the USERDOES.<NodeNr>
  43. |------------------------------------------------------------------------}
  44.  
  45. Procedure ClearDoingInfo(LineNr : Byte);
  46.  
  47.  
  48. Implementation
  49.  
  50. Type Str2 = String[2];
  51.  
  52. Var  RAPath : ComStr;
  53.  
  54. Function S(Number : Byte;Size:Byte):Str2;
  55. Var HStr : Str2;
  56. Begin
  57. Str(Number:Size,HStr);
  58. S:=HStr;
  59. End;
  60.  
  61. Procedure CompletePath(Var Path : String);
  62. Begin
  63. Path:=FExpand(Path);
  64. If (Path[Length(Path)]<>'\') And
  65.    (Path[Length(Path)]<>':')
  66.    Then Path:=Path+'\';
  67. End;
  68.  
  69. Function GrabInfo(LineNr : Byte):DoString;
  70. Var DoIt : Text;
  71.     Line : DoString;
  72. Begin
  73. FileMode:=64; { ReadOnly/ShareDenyNone }
  74.  
  75. Assign(DoIt,RAPath+'UserDoes.'+S(LineNr,0));
  76. Reset(DoIt);
  77. If IoResult<>0
  78.    Then Begin
  79.         GrabInfo:=DefaultStr;
  80.         Exit;
  81.         End;
  82. ReadLn(DoIt,Line);
  83. Close(DoIt);
  84. If Length(Line)>70
  85.    Then Line[0]:=#70;
  86. GrabInfo:=Line;
  87. End;
  88.  
  89. Procedure SetDoingInfo(LineNr : Byte);
  90. Var DoIt : Text;
  91. Begin
  92. FileMode:=49;  { WriteOnly/ShareDenyRead }
  93. Assign(DoIt,RaPath+'UserDoes.'+S(LineNr,0));
  94. Rewrite(DoIt);
  95. WriteLn(DoIt,DoingWhat);
  96. Close(DoIt);
  97. End;
  98.  
  99. Procedure ClearDoingInfo(LineNr : Byte);
  100. Var DoIt : File;
  101. Begin
  102. FileMode:=17; { WriteOnly/ShareDenyAll }
  103. Assign(DoIt,RAPath+'UserDoes.'+S(LineNr,0));
  104. Erase(DoIt);
  105. End;
  106.  
  107.  
  108.  
  109.  
  110. Begin
  111. RAPath:=GetEnv('RA');
  112. CompletePath(RAPath);
  113. End.
  114.